/********************************************************************************
 *      Copyright:  (C) 2023 xiemujie<1289180278@qq.com>
 *                  All rights reserved.
 *
 *       Filename:  templog.h
 *    Description:  This file 
 *
 *        Version:  1.0.0(2023年04月01日)
 *         Author:  xiemujie <1289180278@qq.com>
 *      ChangeLog:  1, Release initial version on "2023年04月01日 13时24分16秒"
 *                 
 ********************************************************************************/
#include <stdarg.h>

#ifndef _TEMPLOG_H_
#define _TEMPLOG_H_


enum
{
	LOG_LEVEL_ERROR,
	LOG_LEVEL_WARN,
	LOG_LEVEL_INFO,
	LOG_LEVEL_DEBUG,
	LOG_LEVEL_MAX,
};

#define LOG_FILE_SIZE   (8*1024)
#define LOG_BUF_MAX_LEN (1024)

#define LOG_STRING_ERROR "ERROR"
#define LOG_STRING_WARN  "WARN"
#define LOG_STRING_INFO  "INFO"
#define LOG_STRING_DEBUG "DEBUG"

int log_init(char *filename, int loglevel);
void log_term(void);
int log_cleanup(int res);
void log_generic(const int level, const char* format, va_list args);

void log_error(char *format, ...);
void log_warn(char *format, ...);
void log_info(char *format, ...);
void log_debug(char *format, ...);

#endif
